package study.javaee.practice.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import study.javaee.practice.common.BO.Result;
import study.javaee.practice.dao.UnitDao;
import study.javaee.practice.entity.Unit;

import javax.annotation.Resource;

@RestController
@RequestMapping("/unit")
public class GetUnitController {
    @Resource
    UnitDao unitDao;

    @GetMapping("/{unitId}")
    public Result<?> getById(@PathVariable Long unitId) {
        return Result.success(unitDao.selectById(unitId));
    }
}
